// Evol scripts.
// Author:
//    Reid
// Description:
//    Potion seller, she is part of the Enora's noob quests.

001-1,65,116,0	script	Q'Pid#001-1	NPC_QPID,{

    function riddle_enigma {
        speech 5,
            l("Ok fine, you have up to 3 tries, here is the riddle:"),
            l("What is growing and shrinking at the same time?");
        narrator 4,
            l("You need to type the answer of this riddle in the NPC window."),
            l("The answer is a single word, without conjugation."),
            l("You can also answer in your native language or in English.");

        do
        {
            input .@answer$;
            .@i++;

            if (riddlevalidation (.@answer$, "life", l("life")))
            {
                speech 5,
                    l("Oh..."),
                    l("You seem more cultivated than you look.");

                if (getq (ArtisQuests_Enora) == 7)
                {
                    setq (ArtisQuests_Enora, 9);
                    speech 12,
                        l("Fine, take these potions, I will replenish them in the next couple hours anyway.");
                }

                break;
            }
            else if (.@i < 3)
            {
                speech 5,
                    l("Too bad, try again.");
            }
            else
            {
                if (getq (ArtisQuests_Enora) == 7)
                {
                    setq (ArtisQuests_Enora, 8);
                    speech 5,
                        l("You failed!"),
                        l("Ivan is the one you should look for now."),
                        l("He is in a small house between the dock's warehouse and the dojo."),
                        l("Follow the canal to the north-east and you will find it."),
                        l("And get out of here, I'm not a map!");
                }
                else
                {
                    speech 5,
                        l("You failed!");
                }

                break;
            }
        } while (true);

        return;
    }

    function enora_quest {
        speech 5,
            l("She wants? What if I don't want?"),
            l("I'm not a pawn of the Legion, I don't have to obey you!"),
            l("Oh and guess what! I'm almost out of potions anyway.");

        switch (select (l("And where can I find these potions?"),
                        l("You bored me, see you later.")))
        {
            case 1:
                break;
            case 2:
                return;
        }

        speech 5,
            l("You don't seem to be from the Legion, let's do a game."),
            l("If you find the correct answer, I will give you these potions..."),
            l("But if you fail, you will have to get them from the alchemist."),
            l("Deal?");

        if (askyesno() == ASK_YES)
        {
            riddle_enigma;
        }
        return;
    }

    function alchemist_information {
        speech 5,
            l("Do? I don't do them."),
            l("I'm sure that you already knew the answer, didn't you?"),
            l("You tried to embarrass me, am I right?!"),
            lg("It's Ivan... I'm sure that he sent you to annoy me..."),
            l("I'm just a merchant, I trade and make deals, yes \"excuse\" me if I'm not as skilled as that stupid alchemist."),
            l("But rare are those that receive grants from the Legion itself. For anybody else only a hard work can pay your bills!");
        emotion E_UPSET;

        switch (select (l("Sorry I didn't mean to bother you."),
                        l("You are just sitting on the shadow of your store.")))
        {
            case 1:
                mes "";
                mesn;
                break;
            case 2:
                speech 5, l("You are honest, I like it.");
                break;
        }
        mesq l("Is that all you had to say?");
        next;

        return;
    }

    speech 4,
        l("What?");

    do
    {
        .@enora = getq(ArtisQuests_Enora);

        select
            rif (.@enora == 7, l("Enora wants her potions.")),
            menuaction(l("Trade")),
            rif (.@enora > 7, l("What was your riddle?")),
            l("How do you do your potions?"),
            l("What are you reading?"),
            menuaction(l("Quit"));

        switch (@menu)
        {
            case 1:
                enora_quest;
                break;
            case 2:
                closedialog;
                shop "Store#Potion001-1";
                close;
            case 3:
                riddle_enigma;
                break;
            case 4:
                alchemist_information;
                break;
            case 5:
                speech 5,
                    l("It's a poem, about poems... Why are you asking that?"),
                    l("Because I am a Kralog I can't read such things? That's rubbish."),
                    l("I borrowed it from the library, you should try to cultivate yourself more instead of insinuate things about people you don't know!");
                break;
        }
    } while (@menu != 6);

    closedialog;
    goodbye;
    close;

OnInit:
    .sex = G_FEMALE;
    .distance = 3;
    end;
}
